/*
 * NotQuery.h
 *
 *  Created on: 2020年12月13日
 *      Author: san
 */

#ifndef NOTQUERY_H_
#define NOTQUERY_H_

#include <memory>

#include "Querybase.h"
#include "Query.h"

class Query;
class NotQuery: public Query_base{
	friend Query operator ~(const Query &);
	inline NotQuery(const Query &q): query(q) { std::cout << "NotQuery(const Query &q)" << std::endl;}
	// 具体的类：NotQuery将定义所有继承而来的纯虚函数
	std::string rep() const override { std::cout << "NotQuery::rep()" << std::endl; return "~(" + query.rep() + ")"; }
	TextQuery::QueryResult eval(const TextQuery &) override;
	Query query;
};

inline Query operator ~(const Query &q)
{
	return std::shared_ptr<Query_base>(new NotQuery(q));
}

#endif /* NOTQUERY_H_ */
